$(function(){
	//在线续方图片跳转 
	$(".online-picture img").on('click',function(){
		location.href = "../../html/onlineContinuation/onlineCourse.html";
	});
	
	//搜索跳转
	$(".online-serch").on('click',function(){
		location.href = "../../html/onlineContinuation/online-serch.html";
	});
	
	//初始化 
	onlineIndexDoctor();
	
	//医生列表渲染
	function onlineIndexDoctor(){
		var param= {
			pageNo:1,
			pageSize:48,
			isrecomm:1,
			isfinevisit:0,
			doctortitle:11,
		};
		function callBackSlider(data){
			console.log(data);
			var html = "";
			
			for (i in data.doctorList) {
				if(!data.doctorList[i].avatar){
					data.doctorList[i].avatar = "../../images/doc-man.png"
				}
				html +="<li v="+data.doctorList[i].id+" z="+data.doctorList[i].imisopen+"><img src='"+data.doctorList[i].avatar+"'/><p class='mui-ellipsis'>"+data.doctorList[i].realname+"</p></li>";
			}
			$(".online-doctor ul").empty();
			$(".online-doctor ul").append(html);
		}
		onlineContinuationModule.onlineDoctorList(param,callBackSlider);
	}
	
	$(".online-doctor ul li").on("click",function(){
		var imopen = $(this).attr("z");
	 	if(imopen==0){
	 		mui.alert("该医生暂未开通在线需方服务");
	 	}else{
			var doctorId=$(this).attr("v");
			var result=checkUnfinishedOrder(USERID,doctorId);
			if(result==true){
				location.href = "../../html/onlineContinuation/medication-consultation.html?doctorId="+doctorId;
			}else{
				return false;
			}
		}
	});
});